import { createRouter, createWebHashHistory } from 'vue-router'
import { dynamicRoutes } from './route';

// createWebHashHistory hash 路由
// createWebHistory history 路由
// createMemoryHistory 带缓存 history 路由

const router = createRouter({
    history: createWebHashHistory(),
    routes: dynamicRoutes
})

import NProgress from "utils/progress"

// 路由加载前
router.beforeEach((to, from, next) => {
    NProgress.start();
    
    next();
});

// 路由加载后
router.afterEach(() => {
    NProgress.done()
});

export default router
